package com.neutech.neudoc.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neutech.neudoc.mapper.CheckTemplateMapper;
import com.neutech.neudoc.mapper.DocMapper;
import com.neutech.neudoc.mapper.RecordTypeMapper;
import com.neutech.neudoc.mapper.ScopeMapper;
import com.neutech.neudoc.service.DocService;
import com.neutech.neudoc.vo.ToAddCheckVo;
import com.neutech.po.CheckTemplate;
import com.neutech.po.Constantitem;
import com.neutech.po.NeuDoc;

@Service
public class DocServiceImpl implements DocService{
	@Autowired
	private DocMapper docMapper;
	@Autowired
	private CheckTemplateMapper checkTemplateMapper;
	@Autowired
	private ScopeMapper scopeMapper;
	@Autowired
	private RecordTypeMapper recordTypeMapper;
	public NeuDoc getDocById(int id){
		return docMapper.getDocById(id);
	}
	public void updateDocById() {
		NeuDoc doc = new NeuDoc();
		doc.setUsername("吕大夫");
		doc.setId(1);
		docMapper.updateDocById(doc);
	}
	public void deleteDocById(int id) {
		docMapper.deleteDocById(id);
	}
	public void addDoc() {
		NeuDoc doc = new NeuDoc();
		doc.setUsername("巨医生");
		doc.setPassword("456456");
		docMapper.addDoc(doc);
	}
	@Override
	public int addCheck(CheckTemplate checkTemplate) {
		int num = checkTemplateMapper.addCheck(checkTemplate);
		return num;
	}
	@Override
	public ToAddCheckVo toAddCheck() {
		List<Constantitem> scopeList = scopeMapper.queryAll();
		List<Constantitem> recordList = recordTypeMapper.queryAll();
		ToAddCheckVo vo = new ToAddCheckVo();
		vo.setRecordList(recordList);
		vo.setScopeList(scopeList);
		return vo;
	}
}
